import { createBrowserRouter, Navigate } from "react-router-dom";
import Main from "@/layouts/Main";
import Layout from "@/layouts/Index";
import Home from "@/pages/home";
import Earn from "@/pages/market";
import Task from "@/pages/task";
import Nft from "@/pages/nft";
import My from "@/pages/my";

import HomeRecord from "@/pages/home/record";

import TaskRecord from "@/pages/task/record";
import TaskInvite from "@/pages/task/invite";

import MarketDetail from "@/pages/market/detail";


import List from "@/pages/list";
import Demo from "@/pages/demo";

const routes = createBrowserRouter([
  {
    path: "/",
    Component: Main,
    children: [
      {
        path: "",
        element: <Navigate to="/home" replace />,
      },
      {
        path: "home",
        Component: Home,
      },
      {
        path: "market",
        Component: Earn,
      },
      {
        path: "task",
        Component: Task,
      },
      {
        path: "nft",
        Component: Nft,
      },
      {
        path: "my",
        Component: My,
      }
    ]
  },
  {
    path: "home",
    Component: Layout,
    children: [
      {
        path: "record",
        Component: HomeRecord,
      },
    ],
  },
  {
    path: "task",
    Component: Layout,
    children: [
      {
        path: "record",
        Component: TaskRecord,
      },
      {
        path: "invite",
        Component: TaskInvite,
      },
    ],
  },
  {
    path: "market",
    Component: Layout,
    children: [
      {
        path: "detail",
        Component: MarketDetail,
      },
    ],
  },
  {
    path: "list",
    Component: List,
  },
  {
    path: "demo",
    Component: Demo,
  },
]);
export default routes;
